package legway.tests;

import legway.datalogger.*;
import legway.tests.*;
import lejos.nxt.Button;
import lejos.nxt.LCD;
import lejos.nxt.SensorPort;

public class GyroDriftTest {
	private static GyroSensor gyro;

	public static void main(String[] args) {
		gyro = new GyroSensor(SensorPort.S1);
		CustomDataLogger datalogger = new CustomDataLogger("driftTest.log", CustomDataLogger.OVERWRITE, true, "Angular speed");
		
		LCD.drawString("Gyro: ", 2, 1);
		
		double value;
		long timeStart = System.currentTimeMillis();
		
		while(!Button.ESCAPE.isPressed() && System.currentTimeMillis() - timeStart < 600000) {
			value = gyro.getAngularSpeed();
			LCD.drawInt((int)value, 3, 9, 1);
			datalogger.writeInt((int)value);
			try {
				Thread.sleep(500);
			} catch (InterruptedException e) {
			}
		}
		datalogger.close();
	}
}
